#include<iostream>
using namespace std;

bool judge( int &w){
    int rw,lw,rl,ll; // rw means the weight of left end
                     // rl is the distance between the fulcrum and right end.
    cin >> lw >> ll >> rw >> rl;

    bool flag1,flag2;
    flag1 = flag2 = true;
    if(!lw) flag1 = judge(lw);
    if(!rw) flag2 = judge(rw);

    w = lw + rw;
    return  flag1 && flag2 &&  (lw * ll == rw * rl);
}

int main(){


    int case_num; // 案例数量
    cin>> case_num;

    while(case_num--){
        int w;
        if(judge(w)) cout<<"YES"<<endl;
        else cout<<"NO"<<endl;

        if(case_num) cout<<endl;
    }

    return 0;
}